home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 April / Gamestar_61_2004-04_dvdb.iso / DVDStar / Editace / hltp.exe / {app} / Source Code / CZBindMaker / AccountChooser.cs < prev    next >
Text File  |  2003-11-29  |  6KB  |  173 lines

  1. /* 
  2.  * CZ Bind Maker
  3.  * 
  4.  * By: Steven Whitley (aka [CZ] Qw4z0)
  5.  * 
  6.  * CZ Bind Maker is a key Bind utility for Counter-Strike 1.6
  7.  * and is distributed under the GNU Public License.
  8.  * 
  9.  * This program is free software; you can redistribute it and/or
  10.  * modify it under the terms of the GNU General Public License
  11.  * as published by the Free Software Foundation; either version 2
  12.  * of the License, or (at your option) any later version.
  13.  * 
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details. 
  18.  * 
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  22.  * 
  23.  * If you need further support for this program you may visit
  24.  * http://www.bindmaker.org/ and post in the forums there for help.
  25.  * 
  26.  *  
  27.  * Any Changes or modifications of this source may be submitted for inclusion
  28.  * in the official release of CZ Bind Maker to Steve Whitley at support@bindmaker.org.
  29.  *  
  30.  * Be sure to comment your code as follows:
  31.  * 
  32.  * // [ AUTHOR ] [ DATE ] 
  33.  * // [ DESCRIPTION OF THE CHANGE OR ADDITION ]
  34.  * 
  35.  * */
  36.  
  37. /* ###############################################
  38.  * #          Sand Bar Library License           #
  39.  * ###############################################
  40.  * 
  41.  * This release of SandBar is available at no charge for you to use in your freeware products 
  42.  * royalty-free. This license does not allow distribution of SandBar with software that is
  43.  * sold or generates income in any way. Use of this release is subject to my name being
  44.  * displayed as a credit in the About dialog in your application. If this is unacceptable you
  45.  * will need to purchase the commercial license.
  46.  * 
  47.  * When distributing this product with software where the source code is available (under
  48.  * GPL or other similar licenses) you are required to distribute this license file with the
  49.  * binary. This is to ensure other developers understand fully the terms of this release.
  50.  * 
  51.  * By using, downloading or posessing this product you agree not to attempt to decompile or
  52.  * reverse engineer it in any way. Enjoy!
  53.  * 
  54.  * Tim Dawson
  55.  * http://www.divil.co.uk/net/
  56.  * 
  57.  * */
  58.  
  59. using System;
  60. using System.Drawing;
  61. using System.Collections;
  62. using System.ComponentModel;
  63. using System.Windows.Forms;
  64. using System.IO;
  65. using Microsoft.Win32;
  66.  
  67. namespace CZBindMaker
  68. {
  69.     /// <summary>
  70.     /// Summary description for AccountChooser.
  71.     /// </summary>
  72.     public class AccountChooser : System.Windows.Forms.Form
  73.     {
  74.         private RegistryKey m_rKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Valve\Steam");
  75.         private DirectoryInfo[] m_list;
  76.         private System.Windows.Forms.ListBox AccountList;
  77.         private System.Windows.Forms.Button Ok;
  78.         /// <summary>
  79.         /// Required designer variable.
  80.         /// </summary>
  81.         private System.ComponentModel.Container components = null;
  82.  
  83.         public AccountChooser(DirectoryInfo[] list_arg)
  84.         {
  85.             this.m_list = list_arg;
  86.  
  87.             InitializeComponent();
  88.  
  89.             foreach(DirectoryInfo dmem in m_list)
  90.             {
  91.                 this.AccountList.Items.Add(dmem.Name);
  92.             }
  93.         }
  94.  
  95.         /// <summary>
  96.         /// Clean up any resources being used.
  97.         /// </summary>
  98.         protected override void Dispose( bool disposing )
  99.         {
  100.             if( disposing )
  101.             {
  102.                 if(components != null)
  103.                 {
  104.                     components.Dispose();
  105.                 }
  106.             }
  107.             this.m_rKey.Close();
  108.             base.Dispose( disposing );
  109.         }
  110.  
  111.         #region Windows Form Designer generated code
  112.         /// <summary>
  113.         /// Required method for Designer support - do not modify
  114.         /// the contents of this method with the code editor.
  115.         /// </summary>
  116.         private void InitializeComponent()
  117.         {
  118.             
  119.             System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(AccountChooser));
  120.             this.AccountList = new System.Windows.Forms.ListBox();
  121.             this.Ok = new System.Windows.Forms.Button();
  122.             this.SuspendLayout();
  123.             // 
  124.             // AccountList
  125.             // 
  126.             this.AccountList.Location = new System.Drawing.Point(8, 8);
  127.             this.AccountList.Name = "AccountList";
  128.             this.AccountList.Size = new System.Drawing.Size(272, 225);
  129.             this.AccountList.Sorted = true;
  130.             this.AccountList.TabIndex = 0;
  131.             this.AccountList.DoubleClick += new System.EventHandler(this.AccountList_DoubleClick);
  132.             // 
  133.             // Ok
  134.             // 
  135.             this.Ok.Location = new System.Drawing.Point(109, 240);
  136.             this.Ok.Name = "Ok";
  137.             this.Ok.TabIndex = 1;
  138.             this.Ok.Text = "Ok";
  139.             this.Ok.Click += new System.EventHandler(this.Ok_Click);
  140.             // 
  141.             // AccountChooser
  142.             // 
  143.             this.AcceptButton = this.Ok;
  144.             this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  145.             this.ClientSize = new System.Drawing.Size(292, 272);
  146.             this.Controls.Add(this.Ok);
  147.             this.Controls.Add(this.AccountList);
  148.             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  149.             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  150.             this.MaximizeBox = false;
  151.             this.MinimizeBox = false;
  152.             this.Name = "AccountChooser";
  153.             this.ShowInTaskbar = false;
  154.             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  155.             this.Text = "   Select an Account";
  156.             this.ResumeLayout(false);
  157.  
  158.         }
  159.         #endregion
  160.  
  161.         private void Ok_Click(object sender, System.EventArgs e)
  162.         {
  163.             CZBindMaker.CZBindMakerMainForm.m_configTransferPath = this.AccountList.SelectedItem.ToString();
  164.             this.DialogResult = DialogResult.OK;
  165.         }
  166.  
  167.         private void AccountList_DoubleClick(object sender, System.EventArgs e)
  168.         {
  169.             Ok_Click(sender,e);
  170.         }
  171.     }
  172. }
  173.